import React, { Component } from 'react'
import axios from 'axios'


export default class App extends Component {

  getStudentData = () => {
    axios.get('http://localhost:3000/api1/students').then(res=>{
        console.log(res.data);
    }, err => {
        console.log("失败了", err);
    })
  }

  getCarData = () => {
    axios.get('http://localhost:3000/api2/cars').then(res=>{
        console.log(res.data);
    }, err => {
        console.log("失败了", err);
    }) 
  }


  render() {
    return (
      <div>
        <button onClick={this.getStudentData}>点我获取学生信息</button>
        <button onClick={this.getCarData}>点我获取汽车的信息</button>
      </div>
    )
  }
}
